<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ol id="list">
        <li>列表1</li>
        <li>列表2</li>
        <li>列表3</li>
        <li>列表4</li>
    </ol>


    <script>
        //通过点击子元素来触发父元素事件称为事件代理
        var list = document.getElementById("list");
        list.addEventListener("click",function(){
            console.log("点击了");
            
        })
        list.addEventListener("click",function(e){
            if(e.target.tagName === "LI"){
                console.log(e.target.innerHTML);
                
            }
        })

    </script>
</body>
</html>